Part 3: Tutorial 01 (7.0-7.5)

1 minute read

Published:

(this tutorial is work-in progress…)

Tutorial 1:

In OptiX, before starting ray tracing on the GPU, it is necessary to copy data from the CPU side to the GPU side, build an AS, build an SBT, etc.

  1. create Context (optix, device, and cuda context)
  2. crease Acceleration Structure (aka, build)
  3. create Module (that holds the programs from CUDA, called shader in OpenGL, Vulkan, and DX)
  4. create Program Group/s (hold one or more Modules)
  5. create Pipeline
  6. create Shader Binding Table

Programs

  1. Closest Hit Program: most common, and it is executed when there is the closest intersection between ray and object. Typically the purpose of the closest hit program is to determine the color of the intersection point. The user can create multiple closest hit programs and bind each to objects in the scene, so that different objects may have different appearances Ref: game work library documentation, older optix version.
  2. Miss Program:
  3. Ray Generation Program: To create the rays themselves, we will use a pinhole camera model. The ray generation program is responsible for creating a ray, shooting it into the scene, and copying the resulting color into an output buffer. Output buffers are subsequently used by the host for further analysis or by OpenGL for rendering. OptiX can write to an arbitrary number of output buffers, and those buffers can have arbitrary types.

The single output buffer is a two-dimensional RGBA8 image that is designed for efficient transfer to an OpenGL texture.